PeachDrawing.Text

PeachDrawing.Text.Compression.BrotliCompression

BrotliCompression.TryCompress(ReadOnlySpan<byte>, int, byte[]) Method

Compresses data as one Brotli stream. Returns false (and an empty array) when no encoder is available or compression failed; it does not throw for either.

public static bool TryCompress(System.ReadOnlySpan<byte> data, int quality, out byte[] compressed);

Parameters

data System.ReadOnlySpan<System.Byte>

the bytes to compress

quality System.Int32

the Brotli quality, clamped to 0-11 (11 is smallest and slowest)

compressed System.Byte[]

the Brotli-compressed bytes on success

Returns

System.Boolean